package com.mmz.test.thread;

public class ParentChildSyn {
    public static int i=10;
    public  void pa(){
        i--;
    }


    static class child extends ParentChildSyn {

        public void asd(){
            String str = "asdasd";
             Integer i=0;
            synchronized (i){
                System.out.println("asdasd");
            }
        }

        public synchronized void ch(){
            while (i>0){
                i--;
                System.out.println("ch"+i);
                pa();
                System.out.println("pa"+i);
            }

        }


    }

    public static void main(String[] args) {
        final child c = new child();
        new Thread(new Runnable() {
            public void run() {
                c.ch();
            }
        }).start();
    }
}
